<!DOCTYPE html>
<html lang="zh">
<head>
  <#assign title="网站配置">
  <#include "/head.html">
</head>
  
<body>
<div class="container-fluid p-t-15">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
            
            <form id="submitForm" action="" method="post" class="edit-form">
              <div class="form-group">
                <label for="web_site_title">网站标题</label>
                <input class="form-control" type="text" id="web_site_title" name="web_site_title" value="${config.web_site_title}" placeholder="请输入站点标题">
              </div>
              <div class="form-group">
                <label>LOGO类型</label>
                <div class="form-controls">
                  <div class="custom-control custom-radio custom-control-inline">
		            <input type="radio" id="typeText" name="web_site_logo_type" class="custom-control-input" value="TEXT" <#if config.web_site_logo_type == 'TEXT'>checked</#if>>
		            <label class="custom-control-label" for="typeText">文字</label>
		          </div>
	              <div class="custom-control custom-radio custom-control-inline">
		            <input type="radio" id="typeImage" name="web_site_logo_type" class="custom-control-input" value="IMAGE" <#if config.web_site_logo_type == 'IMAGE'>checked</#if>>
		            <label class="custom-control-label" for="typeImage">图片</label>
		          </div>
                </div>
              </div>
              
              <div class="form-group" <#if config.web_site_logo_type != 'TEXT'>style="display: none;"</#if>>
                <label for="web_site_logo_text">LOGO文字</label>
                <input class="form-control" type="text" id="web_site_logo_text" name="web_site_logo_text" value="${config.web_site_logo_text}" placeholder="请输入站点LOGO">
              </div>
              
              <div class="form-group file-group" <#if config.web_site_logo_type != 'IMAGE'>style="display: none;"</#if>>
                <label for="web_site_logo_image">LOGO图片</label>
	            <div class="input-group">
	              <input type="text" class="form-control file-value" id="web_site_logo_image" name="web_site_logo_image" value="${config.web_site_logo_image}" placeholder="LOGO图片地址" />
	              <input type="file" class="d-none" file-type="image" />
	              <div class="input-group-append">
	                <button class="btn btn-default file-browser" type="button">上传图片</button>
	              </div>
	            </div>
              </div>
              
              
              <div class="form-group">
                <label for="upload_image_ext">上传图片类型</label>
                <input class="form-control" type="text" id="upload_image_ext" name="upload_image_ext" value="${config.upload_image_ext}">
                <small class="help-block">多个后缀用逗号隔开，不填写则不限制类型</small>
              </div>
              <div class="form-group">
                <label for="web_site_keywords">站点关键词</label>
                <input class="form-control" type="text" id="web_site_keywords" name="web_site_keywords" value="${config.web_site_keywords}" placeholder="请输入站点关键词">
                <small class="help-block">网站搜索引擎关键字</small>
              </div>
              <div class="form-group">
                <label for="web_site_description">站点描述</label>
                <textarea class="form-control" id="web_site_description" rows="5" name="web_site_description" placeholder="请输入站点描述">${config.web_site_description}</textarea>
                <small class="help-block">网站描述，有利于搜索引擎抓取相关信息</small>
              </div>
              <div class="form-group">
                <label for="web_site_copyright">版权信息</label>
                <input class="form-control" type="text" id="web_site_copyright" name="web_site_copyright" value="${config.web_site_copyright}" placeholder="请输入版权信息">
              </div>
            </form>
            
            <button class="btn btn-primary m-r-5" onclick="doSubmit()">确认保存</button>
            <button class="btn btn-default m-r-5" onclick="removeCache()">删除缓存</button>
		
		</div>
      </div>
    </div>
        
  </div>
  
</div>

<#include "/footer.html">

<script type="text/javascript">
var prefix = "system/config";

$(':radio[name="web_site_logo_type"]').change(function() {
	if ($(this).val() == 'IMAGE') {
		$('#web_site_logo_image').parents('.form-group').show();
		
		$('#web_site_logo_text').parent().hide();
		$('#web_site_logo_text').val('');
	} else {
		$('#web_site_logo_text').parent().show();
		
		$('#web_site_logo_image').parents('.form-group').hide();
		$('#web_site_logo_image').val('');
	}
});

function doSubmit() {
	var $form = $('#submitForm');

	ajaxPost({ 
		url: prefix + '/update',
		data: $form.serialize()
	});
}
</script>

</body>
</html>